home *** CD-ROM | disk | FTP | other *** search
/ The Disc - MacWorld 1995 / PowerComputing (The Disc)(MacWorld 1995).ISO / mac / CDFACTOR / NEW_DEMO / CDFACTORY / CDFACTORY.DXR / 00056_parent -change graphic-.ls < prev    next >
Encoding:
Text File  |  1995-07-13  |  9.8 KB  |  229 lines

  1. property selectedCastList, theFilePath, theIFTXT
  2.  
  3. on birth me
  4.   global gmasterfolderpath, gDelimiter, gFileName
  5.   set theFilePath to gmasterfolderpath & "GRAPHIC" & gDelimiter
  6.   set theIFTXTPath to gmasterfolderpath & getProp(gFileName, #IFTXT)
  7.   fileIOread(theIFTXTPath)
  8.   set theIFTXT to the result
  9.   if not (item 2 of line 1 of theIFTXT = "2") then
  10.     alert("please use NEW IFbuilder")
  11.     quit()
  12.   end if
  13.   return me
  14. end
  15.  
  16. on importGraphic me, external
  17.   global gSoundLevel, gPictTransition, gHelpChapter, gHelpParagraph, gchaptertextheight, glessonnumber, gChapterBtnLocList, gVolumeBtnLocList, gColor, gFieldTop, onIBM, gIntroPictRect, gIntroMovieRect, gSpliteSetList, gDoorLoc, gDoorOpen, gIntroText2, grectlist
  18.   if external = 0 then
  19.     set the colorDepth to integer(item 1 of line 2 of theIFTXT)
  20.   else
  21.     set the colorDepth to external
  22.   end if
  23.   importCast(me, "BACKGND.PCT")
  24.   importCast(me, "PLAY_UP.PCT")
  25.   importCast(me, "PLAY_DN.PCT")
  26.   importCast(me, "PAUSE_UP.PCT")
  27.   importCast(me, "PAUSE_DN.PCT")
  28.   importCast(me, "LEFT_UP.PCT")
  29.   importCast(me, "LEFT_DN.PCT")
  30.   importCast(me, "RIGHT_UP.PCT")
  31.   importCast(me, "RIGHT_DN.PCT")
  32.   importCast(me, "SLIDER.PCT")
  33.   importCast(me, "VOLUME.PCT")
  34.   importCast(me, "INDEX_UP.PCT")
  35.   importCast(me, "INDEX_DN.PCT")
  36.   importCast(me, "MENU_UP.PCT")
  37.   importCast(me, "MENU_DN.PCT")
  38.   importCast(me, "QUIT_UP.PCT")
  39.   importCast(me, "QUIT_DN.PCT")
  40.   importCast(me, "HELP_UP.PCT")
  41.   importCast(me, "HELP_DN.PCT")
  42.   importCast(me, "INDEXBKG.PCT")
  43.   importCast(me, "RETURNUP.PCT")
  44.   importCast(me, "RETURNDN.PCT")
  45.   if integer(item 3 of line 2 of theIFTXT) = 0 then
  46.     set theDoor to 0
  47.   else
  48.     set theDoor to 1
  49.     importCast(me, "DOORB_UP.PCT")
  50.     importCast(me, "DOORB_DN.PCT")
  51.     importCast(me, "DOOR.PCT")
  52.   end if
  53.   set gSoundLevel to integer(item 2 of line 2 of theIFTXT)
  54.   set the soundLevel to gSoundLevel
  55.   set the puppet of sprite 47 to 1
  56.   set the rect of sprite 47 to rect(0, 0, 640, 480)
  57.   set the foreColor of sprite 47 to integer(item 4 of line 2 of theIFTXT)
  58.   if integer(item 5 of line 2 of theIFTXT) then
  59.     set gIntroPictRect to item 3 to 6 of line 5 of theIFTXT
  60.   else
  61.     set gIntroPictRect to EMPTY
  62.   end if
  63.   if integer(item 6 of line 2 of theIFTXT) then
  64.     set gIntroMovieRect to item 3 to 6 of line 6 of theIFTXT
  65.   else
  66.     set gIntroMovieRect to EMPTY
  67.   end if
  68.   set gPictTransition to integer(item 7 of line 2 of theIFTXT)
  69.   set gHelpChapter to integer(item 8 of line 2 of theIFTXT)
  70.   if voidp(gHelpChapter) then
  71.     set gHelpChapter to 1
  72.   end if
  73.   set gHelpParagraph to integer(item 9 of line 2 of theIFTXT)
  74.   if voidp(gHelpParagraph) then
  75.     set gHelpParagraph to 1
  76.   end if
  77.   set the textFont of cast 32 to returnFont(item 1 of line 3 of theIFTXT)
  78.   set the textSize of cast 32 to integer(item 2 of line 3 of theIFTXT)
  79.   set the textHeight of cast 32 to integer(item 3 of line 3 of theIFTXT)
  80.   set gchaptertextheight to integer(item 3 of line 3 of theIFTXT)
  81.   set the textStyle of cast 32 to item 4 of line 3 of theIFTXT
  82.   set the textFont of cast 33 to returnFont(item 1 of line 4 of theIFTXT)
  83.   set the textSize of cast 33 to integer(item 2 of line 4 of theIFTXT)
  84.   set the textHeight of cast 33 to integer(item 3 of line 4 of theIFTXT)
  85.   set the textStyle of cast 33 to item 4 of line 4 of theIFTXT
  86.   set gColor to []
  87.   setSpriteRect(me, 7)
  88.   set theRect to BoxToRect(item 3 to 6 of line 8 of theIFTXT)
  89.   set the puppet of sprite 7 to 1
  90.   set the rect of sprite 7 to theRect
  91.   set the puppet of sprite 8 to 1
  92.   set the rect of sprite 8 to theRect
  93.   set theTextRect to BoxToRect(item 3 to 6 of line 10 of theIFTXT)
  94.   setAt(theTextRect, 4, getAt(theTextRect, 2) + (gchaptertextheight * glessonnumber) + (gchaptertextheight / 2))
  95.   set the puppet of sprite 9 to 1
  96.   set the rect of cast 32 to theTextRect
  97.   set the rect of sprite 9 to theTextRect
  98.   if (getAt(theTextRect, 3) - getAt(theTextRect, 1)) > (getAt(theRect, 3) - getAt(theRect, 1)) then
  99.     setAt(theTextRect, 4, getAt(theTextRect, 2) + (gchaptertextheight * glessonnumber))
  100.     set the puppet of sprite 6 to 1
  101.     set the rect of sprite 6 to theTextRect
  102.     set gFieldTop to getAt(theTextRect, 2) - gchaptertextheight
  103.   else
  104.     setAt(theRect, 4, getAt(theRect, 2) + (gchaptertextheight * glessonnumber))
  105.     set the puppet of sprite 6 to 1
  106.     set the rect of sprite 6 to theRect
  107.     set gFieldTop to getAt(theRect, 2) - gchaptertextheight
  108.   end if
  109.   setSpriteRect(me, 11)
  110.   setSpriteRect(me, 12)
  111.   setSpriteRect(me, 13)
  112.   setSpriteRect(me, 14)
  113.   setSpriteRect(me, 15)
  114.   set theRect to BoxToRect(item 3 to 6 of line 16 of theIFTXT)
  115.   set the puppet of sprite 15 to 1
  116.   set the rect of cast 33 to theRect
  117.   set the rect of sprite 15 to theRect
  118.   setSpriteRect(me, 17)
  119.   setSpriteRect(me, 18)
  120.   setSpriteRect(me, 19)
  121.   setSpriteRect(me, 20)
  122.   set gSpliteSetList to []
  123.   add(gSpliteSetList, [47, 48])
  124.   if theDoor then
  125.     set gDoorLoc to []
  126.     set gDoorOpen to 0
  127.     setSpriteRect(me, 21)
  128.     setSpriteRect(me, 22)
  129.     set DoorLoc to item 3 to 9 of line 33 of theIFTXT
  130.     if item 8 of DoorLoc = EMPTY then
  131.       set firstH to integer(item 1 of DoorLoc)
  132.       set firstV to integer(item 2 of DoorLoc)
  133.       set stepH to integer(item 3 of DoorLoc)
  134.       set stepV to integer(item 4 of DoorLoc)
  135.       set step to integer(item 5 of DoorLoc)
  136.       repeat with m = 0 to step
  137.         append(gDoorLoc, [firstH + (stepH * m), firstV + (stepV * m)])
  138.       end repeat
  139.     else
  140.       set firstH to integer(item 1 of DoorLoc)
  141.       set firstV to integer(item 2 of DoorLoc)
  142.       set lastH to integer(item 6 of DoorLoc)
  143.       set lastV to integer(item 7 of DoorLoc)
  144.       set step to integer(item 5 of DoorLoc)
  145.       set stepH to float(lastH - firstH) / step
  146.       set stepV to float(lastV - firstV) / step
  147.       repeat with m = 0 to step - 1
  148.         append(gDoorLoc, [integer(firstH + (stepH * m)), integer(firstV + (stepV * m))])
  149.       end repeat
  150.       append(gDoorLoc, [lastH, lastV])
  151.     end if
  152.     add(gSpliteSetList, [1, 6, 7, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 24])
  153.   else
  154.     add(gSpliteSetList, [1, 6, 7, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 24])
  155.   end if
  156.   set the puppet of sprite 24 to 1
  157.   set the rect of sprite 24 to BoxToRect(item 3 to 6 of line 24 of theIFTXT)
  158.   set the puppet of sprite 26 to 1
  159.   set the rect of sprite 26 to BoxToRect(item 3 to 6 of line 25 of theIFTXT)
  160.   setSpriteRect(me, 26)
  161.   setSpriteRect(me, 27)
  162.   set bigrect to item 3 to 6 of line 28 of theIFTXT
  163.   set mediumrect to item 3 to 6 of line 29 of theIFTXT
  164.   set smallrect to item 3 to 6 of line 30 of theIFTXT
  165.   set soundrect to item 3 to 6 of line 30 of theIFTXT
  166.   set gChapterBtnLocList to BoxToRect(item 3 to 6 of line 31 of theIFTXT)
  167.   set gVolumeBtnLocList to BoxToRect(item 3 to 6 of line 32 of theIFTXT)
  168.   set the ink of sprite 8 to 32
  169.   set the blend of sprite 8 to integer(item 3 of line 34 of theIFTXT)
  170.   set the foreColor of sprite 7 to integer(item 2 of line 35 of theIFTXT)
  171.   set the foreColor of sprite 8 to integer(item 3 of line 35 of theIFTXT)
  172.   add(gColor, returnRGB(integer(item 3 of line 37 of theIFTXT)))
  173.   add(gColor, returnRGB(integer(item 5 of line 38 of theIFTXT)))
  174.   add(gColor, returnRGB(integer(item 3 of line 36 of theIFTXT)))
  175.   add(gColor, returnRGB(integer(item 2 of line 39 of theIFTXT)))
  176.   add(gColor, returnRGB(integer(item 3 of line 39 of theIFTXT)))
  177.   add(gColor, returnRGB(integer(item 4 of line 39 of theIFTXT)))
  178.   add(gColor, integer(item 5 of line 39 of theIFTXT))
  179.   add(gColor, integer(item 6 of line 39 of theIFTXT))
  180.   set the foreColor of cast 32 to getAt(gColor, 1)
  181.   set the foreColor of cast 33 to getAt(gColor, 3)
  182.   set the foreColor of cast 35 to getAt(gColor, 6)
  183.   set the foreColor of cast 34 to getAt(gColor, 4)
  184.   set the puppet of sprite 29 to 1
  185.   set the foreColor of sprite 29 to getAt(gColor, 7)
  186.   set the rect of sprite 29 to rect(492, 107, 615, 119)
  187.   set the puppet of sprite 30 to 1
  188.   set the foreColor of sprite 30 to getAt(gColor, 8)
  189.   set the rect of sprite 30 to rect(500, 108, 517, 117)
  190.   set the puppet of sprite 31 to 1
  191.   set the foreColor of sprite 31 to getAt(gColor, 8)
  192.   set the rect of sprite 31 to rect(500, 385, 517, 394)
  193.   set the puppet of sprite 37 to 1
  194.   set the rect of sprite 37 to rect(492, 107, 615, 395)
  195.   set the textFont of cast 34 to returnFont(item 7 of line 39 of theIFTXT)
  196.   set the textFont of cast 35 to returnFont(item 7 of line 39 of theIFTXT)
  197.   set the textSize of cast 34 to integer(item 8 of line 39 of theIFTXT)
  198.   set the textSize of cast 35 to integer(item 8 of line 39 of theIFTXT)
  199.   set the textHeight of cast 34 to integer(item 9 of line 39 of theIFTXT)
  200.   set the textHeight of cast 35 to integer(item 9 of line 39 of theIFTXT)
  201.   set the textStyle of cast 34 to item 10 of line 39 of theIFTXT
  202.   set the textStyle of cast 35 to item 10 of line 39 of theIFTXT
  203.   set the text of cast 37 to item 2 of line 40 of theIFTXT
  204.   set gIntroText2 to item 2 of line 41 of theIFTXT
  205.   set the foreColor of cast 37 to returnRGB(integer(item 3 of line 42 of theIFTXT))
  206.   set the textFont of cast 37 to returnFont(item 4 of line 42 of theIFTXT)
  207.   set the textSize of cast 37 to integer(item 5 of line 42 of theIFTXT)
  208.   set the textHeight of cast 37 to integer(item 6 of line 42 of theIFTXT)
  209.   set the textStyle of cast 37 to item 7 of line 42 of theIFTXT
  210.   set theRect to BoxToRect(item 8 to 11 of line 42 of theIFTXT)
  211.   set the rect of cast 37 to theRect
  212.   set the puppet of sprite 48 to 1
  213.   set the locH of sprite 48 to getAt(theRect, 1)
  214.   set the locV of sprite 48 to getAt(theRect, 2)
  215.   set grectlist to [bigrect, mediumrect, smallrect, soundrect]
  216. end
  217.  
  218. on setSpriteRect me, n
  219.   set spritenum to integer(item 2 of line n of theIFTXT)
  220.   set the puppet of sprite spritenum to 1
  221.   set the rect of sprite spritenum to BoxToRect(item 3 to 6 of line n of theIFTXT)
  222. end
  223.  
  224. on importCast me, thepictname
  225.   set thecastno to the number of cast thepictname
  226.   importFileInto(cast thecastno, theFilePath & thepictname)
  227.   set the regPoint of cast thecastno to point(the width of cast thecastno / 2, the height of cast thecastno / 2)
  228. end
  229.